import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int [][] arr = new int[3][3];
        for(int i = 0;i<3;++i){
            for(int j = 0;j<3;++j){
                arr[i][j] = sc.nextInt();
            }
        }
        int sum = 0;
        for(int i = 0;i<3;++i){
            for(int j = 0;j<3;++j){
                System.out.printf("   %d",arr[i][j]);
                if(i == j){
                    sum+=arr[i][j];
                }
            }

        }
        System.out.println();
        System.out.println(sum);


    }
}
